#include <bits/stdc++.h>
using namespace std;



int main(int argc, char const *argv[])
{
    vector<int> nums = {-1,0,3,3,5,9,9,9,12};

    auto ptr = find(nums.begin(), nums.end(), 3);
    cout << ptr - nums.begin() << " " << *ptr << endl;

    // [lower_bound, upper_bound) - 存在的元素
    auto p1 = lower_bound(nums.begin(), nums.end(), 3);
    auto p2 = upper_bound(nums.begin(), nums.end(), 3);
    cout << p1 - nums.begin() << " " << p2 - nums.begin() << endl;

    // 不存在的元素，未越界
    p1 = lower_bound(nums.begin(), nums.end(), 4);
    p2 = upper_bound(nums.begin(), nums.end(), 4);
    cout << p1 - nums.begin() << " " << p2 - nums.begin() << endl;

    // 不存在的元素，越界
    p1 = lower_bound(nums.begin(), nums.end(), -2);
    p2 = upper_bound(nums.begin(), nums.end(), -2);
    cout << p1 - nums.begin() << " " << p2 - nums.begin() << endl;
    
    p1 = lower_bound(nums.begin(), nums.end(), 17);
    p2 = upper_bound(nums.begin(), nums.end(), 17);
    cout << p1 - nums.begin() << " " << p2 - nums.begin() << endl;

    return 0;
}
